<?php

define('TIMESTAMP', time());

return [
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'language' => 'zh-CN',
    'bootstrap' => ['yiike\core\Bootstrap'],
    'aliases' => [
        '@mdm/admin' => '@app/extensions/mdm/yii2-admin',
        '@bower' => '@vendor/bower-asset'
    ],
    'timeZone'=>'Asia/Chongqing',
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=we7',
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => 'ims_',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            'useFileTransport' => true,
        ],
        'urlManager' => require(__DIR__ . '/urlManager.php'),
        'authManager' => [
            'class' => 'yii\rbac\DbManager', // or use 'yii\rbac\DbManager'
        ],
        'settings' => [
            'class' => 'pheme\settings\components\Settings'
        ],
        'as globalAccess' => [
            'class' => '\common\behaviors\GlobalAccessBehavior',
        ],
        'as access' => [
            'class' => 'mdm\admin\components\AccessControl',
            'allowActions' => [
                'site/*',
            ]
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
            'cachePath' => '@storage/runtime/cache'
        ],
        'i18n' => [
            'translations' => [
                '*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@common/messages',
                ]
            ],
        ],
        'formatter' => [ //for the showing of date datetime
            'dateFormat' => 'yyyy-MM-dd',
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss',
            'decimalSeparator' => ',',
            'thousandSeparator' => ' ',
            'currencyCode' => 'CNY',
            'nullDisplay' => ''
        ],
        'authClientCollection' => [
            'class'   => 'yii\authclient\Collection',
            'clients' => [
                'qq'     => [
                    'class'        => 'yujiandong\authclient\Qq',
//                    'class' => 'xj\oauth\QqAuth',
                    'clientId'     => '1105674767',
                    'name'         => 'QQ',
                    'clientSecret' => '5b39c08a74dc3fabe6c1817c194fb1ec',
                ],
                'weixin' => [
                    'class'        => 'yujiandong\authclient\Weixin',
                    'class'        => 'xj\oauth\WeixinAuth',
                    'clientId'     => 'wx74c668ec69aeaf43',
                    'clientSecret' => '7653dceb590c8d5744e51d2c5cfba661',
                ]
            ]
        ],
        'credit' => [
            'class' => 'yiike\credit\Credit'
        ],

        'storage' => [
            'class' => 'weyii\filesystem\Manager',
            'default' => 'qiniu',
            'disks' => [
                'local' => [
                    'class' => 'weyii\filesystem\adapters\Local',
                    'root' => '@webroot/storage' // 本地存储路径
                ],
                'qiniu' => [
                    'class' => 'weyii\filesystem\adapters\QiNiu',
                    'accessKey' => 'zMJ3zqxMvdWB2IH2afcnAJkvOFtCqgfxlchl2Kmb',
                    'accessSecret' => '6oskdyWEwBZUy2gopLSDkPKPp78GK22NJlX2mn0e',
                    'bucket' => 'ttyc',
                    'baseUrl' => 'http://cdn1.ttyoucai.cn'
                ],
                'upyun' => [
                    'class' => 'weyii\filesystem\adapters\UpYun',
                    'operatorName' => '又拍云授权操作员账号',
                    'operatorPassword' => '又拍云授权操作员密码',
                    'bucket' => '又拍云的bucket空间',
                ],
                'aliyun' => [
                    'class' => 'weyii\filesystem\adapters\AliYun',
                    'accessKeyId' => '阿里云OSS AccessKeyID',
                    'accessKeySecret' => '阿里云OSS AccessKeySecret',
                    'bucket' => '阿里云的bucket空间',
                    // lanUrl和wanUrl样只需填写一个. 如果填写lanUrl 将优先使用lanUrl作为传输地址
                    // 外网和内网的使用参考: https://help.aliyun.com/document_detail/oss/user_guide/oss_concept/endpoint.html?spm=5176.2020520105.0.0.tpQOiL
                    'lanDomain' => 'OSS内网地址, 如:oss-cn-hangzhou-internal.aliyuncs.com', // 默认不填. 在生产环境下保证OSS和服务器同属一个区域机房部署即可, 切记不能带上bucket前缀
                    'wanDomain' => 'OSS外网地址, 如:oss-cn-hangzhou.aliyuncs.com' // 默认为杭州机房domain, 其他机房请自行替换, 切记不能带上bucket前缀
                ],
          ]
      ],
        'fs' => [//文件存储 https://github.com/creocoder/yii2-flysystem
            'class' => 'creocoder\flysystem\LocalFilesystem',
            'path' => '@storage/web/source',
        ],
        'fileStorage' => [
            'class' => 'trntv\filekit\Storage',
            'baseUrl' => '@storageUrl',
            'filesystemComponent' => 'storage'
        ],
        'smser' => [
            // 中国云信
            'class' => 'daixianceng\smser\WebchineseSmser',
            'username' => 'anarry',
            'password' => 'b9fc274fa6b4fd999152',
            'useFileTransport' => false
        ],
        'smsValidator' => [
            // 短信验证码
            'class' => 'common\models\SmsValidator',
            'template' => [
                'register' => '您的验证码是{code}。如非本人操作，请忽略本短信 【阿那里科技】',
                'forgot' => '您的验证码是{code}。如非本人操作，请忽略本短信 【阿那里科技】'
            ]
        ],
        'consoleRunner' => [
            'class' => 'common\components\ConsoleRunner',
            'file' => '@root/yii' // or an absolute path to console file
        ],
        'view' => [
            'theme' => [
                'pathMap' => [
                    '@dektrium/user/views' => '@yiike/user/views'
                ],
            ],
        ],
    ],
    'modules' => require(__DIR__ . '/modules.php'),
];
